<!DOCTYPE html>
<html>
<head>
    <title></title>
    <link rel="stylesheet" type="text/css" href="../lib/ext/resources/css/ext-all-neptune.css"/>
    <link rel="stylesheet" type="text/css" href="../lib/ckeditor/sample.css" />
    <script type="text/javascript" src="../lib/ext/ext-all.js"></script>
    <script type="text/javascript" src="../lib/gf/common_grid.js"></script>


</head>
<script type="text/javascript">
    Ext.Loader.setConfig({enabled: true});
    var dataForm;
    var data = {};
    Ext.onReady(function () {
        function doImport() {
            var url = "/pre_meeting/import";
            if (!dataForm.getForm().findField("attach_file").getValue()) {
                Ext.Msg.alert('消息提示', '请浏览需要上传的文件!');
                return;
            }
            dataForm.form.submit({
                url: url,
                waitMsg: '正在提交数据，稍后...',
                success: function (form, action) {
                    Ext.Msg.alert('消息提示', '上传成功！');
                },
                failure: function (form, action) {
                    Ext.Msg.alert('消息提示', '上传失败！');
                }
            });
        }
        //关闭窗口
        function doClose(){
            parent.closeWin();
        }
        var tbar = [
            {pressed: true,text: '保  存',handler: doImport,icon : '../img/book.png'},
            {pressed: true,text: "关  闭",handler: doClose,icon : '../img/close.png'}
        ];
        dataForm = new Ext.FormPanel({
            layout : 'fit',
            items: [
                {
                    xtype: 'form',
                    defaultType: 'textfield',
                    items: [
                        {
                            name : '_id',
                            hidden : true
                        },{
                            name : 'type',
                            hidden : true,
                            value : 'replace'
                        } ,
                        {
                            xtype: "filefield",
                            fieldLabel: '选择文件',
                            name: 'attach_file',
                            width : 350
                        } ,{
                            xtype : "label",
                            text : "(仅支持xlsx后缀的excel)",
                            style : 'font-size:15px;color:red'
                        }
                    ],
                    tbar : tbar
                }
            ]
        });
        var _urlparams = Ext.urlDecode(document.URL.split("?")[document.URL.split("?").length - 1]);
        if(_urlparams._id){
            dataForm.form.findField("_id").setValue(_urlparams._id);
        }
        var viewport = new Ext.Viewport({
            layout: 'fit',
            renderTo: "mypanel",
            items: [dataForm]
        });
    });
</script>
<body>
<div id="mypanel" style="height:1024px;width:100%"></div>
</body>
</html>